package com.itheima.reggie.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.reggie.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CategoryDao extends BaseMapper<Category> {
    @Insert("insert into category values(null,#{type},#{name},#{sort},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void save(Category category);

    List<Category> findAll(@Param("type")Integer type);

    @Delete("delete from category where id=#{id}")
    void deleteById(Long id);


    /**
     * 修改分类
     * @param category
     */
    @Update("update category set name=#{name},sort=#{sort},update_time=#{updateTime},update_user=#{updateUser} where id=#{id}")
    void update(Category category);

}
